package com.myk.game.lib;

import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.view.View;

import androidx.annotation.Nullable;

public abstract class CanvasDrawable extends Drawable {

    private final RectF rectF = new RectF();
    private final Paint paint = new Paint();

    public CanvasDrawable(View view) {
        view.post(() -> {
            paint.setAntiAlias(true);
            paint.setDither(true);
            rectF.left = 0;
            rectF.top = 0;
            rectF.right = view.getMeasuredWidth();
            rectF.bottom = view.getMeasuredHeight();
            invalidateSelf();
        });
    }

    @Override
    public void setAlpha(int i) {

    }

    @Override
    public void setColorFilter(@Nullable ColorFilter colorFilter) {

    }

    @Override
    public int getOpacity() {
        return PixelFormat.TRANSLUCENT;
    }
}
